﻿using Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Win.BLL;
using Win.Model;

namespace ShiYan3
{
    public partial class Login : Form
    {
        private LoginBLL loginBLL = new LoginBLL();

        public static string Mtype;

        public Login()
        {
            InitializeComponent();
        }

        private void button_login_Click(object sender, EventArgs e)
        {
            string username = textBox1.Text.Trim();
            string passwd = Md5Helper.GetMd5(textBox2.Text);
            ManagerInfo manager = loginBLL.GetManegerInfo(username, passwd);
            Mtype = manager.MType.ToString();
            if (manager != null)
            {
                MainForm main = new MainForm();
                NewMainForm newMain = new NewMainForm();
                textBox1.Text = "";
                textBox2.Text = "";
                //main.Show();
                newMain.Show();
                Hide();
            }
            else
            {
                MessageBox.Show("账户或密码错误！","错误提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Exclamation);
            }
        }

        private void button_quit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

    }
}
